package tool

import (
	"github.com/jmoiron/sqlx/types"
	"net/http"
)
import "github.com/jackc/pgtype"

type Chat_user struct {
	Status   int              `json:"status"`
	Account  string           `json:"account"`
	Nick     pgtype.Varchar   `json:"nick"`
	CreateAt pgtype.Timestamp `json:"create_at"`
}

type ReplyProto struct {
	//Status, 0: success, others: fault
	Status int `json:"status"`

	//Msg, Action result describe by literal
	Msg string `json:"msg,omitempty"`

	//Data, operand
	Data types.JSONText `json:"data,omitempty"`

	// RowCount, just row count
	RowCount int64 `json:"rowCount,omitempty"`

	//API, call target
	API string `json:"API,omitempty"`

	//Method, using http method
	Method string `json:"method,omitempty"`

	//SN, call order
	SN int `json:"SN,omitempty"`
}

type Message struct {
	Id   int              `json:"id"`
	Type int8             `json:"type"` // 0 系统 1 用户
	Msg  string           `json:"msg"`
	From string           `json:"from"`
	To   string           `json:"to"`
	At   pgtype.Timestamp `json:"at"`
}

type ModuleAuthor struct {
	Name  string `json:"name"`
	Tel   string `json:"tel"`
	Email string `json:"email"`
	Addi  string `json:"addi"`
}

type ServeEndPoint struct {
	Fn   func(r *http.Request, response http.ResponseWriter)
	Path string
	Name string

	Developer *ModuleAuthor
}
